<template>
  <!-- <div class="contianer">son :{{ money }}</div> -->
  <div class="contianer">m :{{ money }}</div>
  <button @click="changeMoney">花50</button>
  <br />
  <Sun />
</template>

<script>
import Sun from './sun.vue'
export default {
  name: 'son',
  components: {
    Sun
  },
  // 子组件接收父组件数据使用props即可
  props: {
    money: {
      type: Number,
      default: 0
    }
  },
  setup(props, context) {
    console.log(context)
    const changeMoney = () => {
      context.emit('chang-money', 50)
    }
    return { changeMoney }
  }
}
</script>

<style lang="less" scoped>
</style>
